*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:      firm_level.do    		                        *;
*       Date:           12/28/2020                                      *;
*       Authora:        Baccini, Guidi, Poletti, and Yildirim           *;
*       Purpose:        Replication of "Trade Liberalization and Labor  *;
*						Market Institutions"                            *;                                                                      
*       Input Files:    firm_level.dta		 					        *; 
*       Output Files:   firm_level_logfile.log		                    *;
*       Machine:        Office                                          *;
*       Program: 		Stata 15                                        *;
*     ****************************************************************  *;
*     ****************************************************************  *;

* Setting initial commands
clear
clear matrix
clear mata
set maxvar 50000
set matsize 11000
set more off 

* Loading the dataset
*cd "Replication File"
use firm_level, clear
log using firm_level_logfile.log

* Relabel main variables
label variable ln_revenue "ln(Revenue)"
label variable coord_dummy "CME"
label variable tariff_cut_export "Export Tariff Cuts"
label variable tfpr_base "TFPR"
label variable wage_max "Wage Ceiling"
label variable empl_pol "Subsidies for VT"
label variable cut_tfpr "Exp Tariff Cuts*TFPR"
label variable cut_coord "Exp Tariff Cuts*CME"
label variable tfpr_coord "TFPR*CME"
label variable cut_tfpr_coord "Exp Tariff Cuts*TFPR*CME"
label variable cut_wage "Exp Tariff Cuts*Wage Ceiling"
label variable tfpr_wage "TFPR*Wage Ceiling"
label variable cut_tfpr_wage "Exp Tariff Cuts*TFPR*Wage Ceiling"
label variable cut_empl "Exp Tariff Cuts*SubsidiesVT"
label variable tfpr_empl "TFPR*SubsidiesVT"
label variable  cut_tfpr_empl "Exp Tariff Cuts*TFPR*SubsidiesVT"


############ MAIN TEXT
* Table 1 and Figure 3
*1
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year)
outreg2 using table1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) r
margins, dydx(tariff_cut_export) at(tfpr_base=(0(5)50)) over(coord_dummy) atmeans level(90) 
marginsplot, addplot((histogram tfpr_base if coord_dummy == 0, percent fcolor(none) lcolor(gs1) yaxis(2) yscale(alt  axis(2))) (histogram tfpr_base if coord_dummy == 1, percent fcolor(none) lcolor(red) yaxis(2) yscale(alt  axis(2)))) level(90)
graph save Graph "L:\January_2019_Backup\1. Replication\Figure3.gph", replace
graph save Graph "L:\January_2019_Backup\1. Replication\Figure3.pdf", replace
*2
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_wage tfpr_wage cut_tfpr_wage MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year)
outreg2 using table1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_wage tfpr_wage cut_tfpr_wage) label append
*3
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_wage tfpr_wage cut_tfpr_wage cut_empl tfpr_empl cut_tfpr_empl MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year)
outreg2 using table1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_wage tfpr_wage cut_tfpr_wage cut_empl tfpr_empl cut_tfpr_empl) label append
*4
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor  time_delta*, absorb(id_naics4 id_country_year) cluster(id_country_year)
outreg2 using table1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*5
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_wage tfpr_wage cut_tfpr_wage MFN hhi ln_kl numyears numyears2 ln_labor  time_delta*, absorb(id_naics4 id_country_year) cluster(id_country_year)
outreg2 using table1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_wage tfpr_wage cut_tfpr_wage) label append
*6
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_wage tfpr_wage cut_tfpr_wage cut_empl tfpr_empl cut_tfpr_empl MFN hhi ln_kl numyears numyears2 ln_labor  time_delta*, absorb(id_naics4 id_country_year) cluster(id_country_year)
outreg2 using table1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_wage tfpr_wage cut_tfpr_wage cut_empl tfpr_empl cut_tfpr_empl) label append

* Table 2
*1
gen cut_patents = tariff_cut_export*patents
gen tfpr_patents=tfpr_base*patents
gen cut_tfpr_patents = tariff_cut_export*tfpr_base*patents
global innov cut_patents tfpr_patents cut_tfpr_patents
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor $innov, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using table2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Innovation, Yes, Corruption, No, Electoral system, No, Migration, No, Unemployement, No, Market structure, No, Access to credit, No, All, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label
*2
gen cut_corr = tariff_cut_export*corruption_1996
gen tfpr_corr=tfpr_base*corruption_1996
gen cut_tfpr_corr = tariff_cut_export*tfpr_base*corruption_1996
global inst cut_corr tfpr_corr cut_tfpr_corr
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor $inst, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using table2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Innovation, No, Corruption, Yes, Electoral system, No, Migration, No, Unemployement, No, Market structure, No, Access to credit, No, All, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*3
gen cut_pr = tariff_cut_export*pr
gen tfpr_pr=tfpr_base*pr
gen cut_tfpr_pr = tariff_cut_export*tfpr_base*pr
global pr cut_pr tfpr_pr cut_tfpr_pr
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor $pr, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using table2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Innovation, No, Corruption, No, Electoral system, Yes, Migration, No, Unemployement, No, Market structure, No, Access to credit, No, All, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*3
gen cut_migration = tariff_cut_export*migration
gen tfpr_migration=tfpr_base*migration
gen cut_tfpr_migration = tariff_cut_export*tfpr_base*migration
global migration cut_migration tfpr_migration cut_tfpr_migration
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor $migration, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using table2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Innovation, No, Corruption, No, Electoral system, No, Migration, Yes, Unemployement, No, Market structure, No, Access to credit, No, All, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*4
gen cut_unempl = tariff_cut_export*unempl_ilo_1995
gen tfpr_unempl=tfpr_base*unempl_ilo_1995
gen cut_tfpr_unempl = tariff_cut_export*tfpr_base*unempl_ilo_1995
global unempl cut_unempl tfpr_unempl cut_tfpr_unempl
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor $unempl, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using table2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Innovation, No, Corruption, No, Electoral system, No, Migration, No, Unemployement, Yes, Market structure, No, Access to credit, No, All, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*6
gen cut_se = tariff_cut_export*se
gen tfpr_se=tfpr_base*se
gen cut_tfpr_se = tariff_cut_export*tfpr_base*se
gen cut_service = tariff_cut_export*service
gen tfpr_service=tfpr_base*service
gen cut_tfpr_service = tariff_cut_export*tfpr_base*service
gen cut_tax = tariff_cut_export*tax
gen tfpr_tax=tfpr_base*tax
gen cut_tfpr_tax = tariff_cut_export*tfpr_base*tax
gen cut_euro = tariff_cut_export*euro
gen tfpr_euro=tfpr_base*euro
gen cut_tfpr_euro = tariff_cut_export*tfpr_base*euro
gen cut_fdi = tariff_cut_export*fdi
gen tfpr_fdi=tfpr_base*fdi
gen cut_tfpr_fdi = tariff_cut_export*tfpr_base*fdi
global market cut_se tfpr_se cut_tfpr_se cut_service tfpr_service cut_tfpr_service cut_tax tfpr_tax cut_tfpr_tax cut_euro tfpr_euro cut_tfpr_euro cut_fdi tfpr_fdi cut_tfpr_fdi
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor $market, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using table2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Innovation, No, Corruption, No, Electoral system, No, Migration, No, Unemployement, No, Market structure, Yes, Access to credit, No, All, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*7
gen cut_credit_p = tariff_cut_export*credit_private_sector
gen tfpr_credit_p=tfpr_base*credit_private_sector
gen cut_tfpr_credit_p = tariff_cut_export*tfpr_base*credit_private_sector
gen cut_credit_b = tariff_cut_export*credit_banks
gen tfpr_credit_b=tfpr_base*credit_banks
gen cut_tfpr_credit_b = tariff_cut_export*tfpr_base*credit_banks
gen cut_credit_f = tariff_cut_export*credit_financial_sector
gen tfpr_credit_f=tfpr_base*credit_financial_sector
gen cut_tfpr_credit_f = tariff_cut_export*tfpr_base*credit_financial_sector
*global credit cut_credit_p tfpr_credit_p cut_tfpr_credit_p cut_credit_b tfpr_credit_b cut_tfpr_credit_b cut_credit_f tfpr_credit_f cut_tfpr_credit_f
global credit1 cut_credit_p tfpr_credit_p cut_tfpr_credit_p 
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor $credit1, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using table2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Innovation, No, Corruption, No, Electoral system, No, Migration, No, Unemployement, No, Market structure, No, Access to credit, Yes, All, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*8
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor $innov $inst $pr $unempl $migration $market $credit1, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using table2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Innovation, No, Corruption, No, Electoral system, No, Migration, No, Unemployement, No, Market structure, No, Access to credit, No, All, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append


############ APPENDIX B
* Figure B2
twoway kdensity tfpr_base if coord_dummy==0 || kdensity tfpr_base if coord_dummy==1
graph save Graph "L:\January_2019_Backup\1. Replication\FigureB2.gph", replace
graph save Graph "L:\January_2019_Backup\1. Replication\FigureB2.pdf", replace

* Figure B3
graph box tfpr_base, over(coord_dummy) 
graph save Graph "L:\January_2019_Backup\1. Replication\FigureB3.gph", replace
graph save Graph "L:\January_2019_Backup\1. Replication\FigureB3.pdf", replace

* Table B1
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) r
sum ln_revenue tfpr_base coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor eprc_v1 ud cent govint ext sector unauthority cfauthority corruption_1996 se service_gdp_1995 tax_gdp_1995 fdi_out_1995 euro credit_private_sector credit_banks credit_financial_sector unempl_ilo_1995 tariff_cut_export wage_max empl_pol tariff_cut_export_pre if e(sample)


############### APPENDIX C
* Table C1
corr coord_dummy $innov $inst $pr $unempl $migration $market $credit1


############### APPENDIX D
* Table D1
gen expt_dummy=1 if expt!=.
replace expt_dummy=0 if expt==0
egen id_naics4_year=group(id_naics4 year)
label variable expt_dummy "Extensive Margins"
label variable exop "Intensive Margins"
label variable staff "Cost of Labor"

*1
xi: reg expt_dummy tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year if expt>=0, cluster(id_naics4_year) r
outreg2 using tableD1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Country fixed efects, No, Year fixed effects, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base) label
*2
xi: reg exop tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year if expt>=0, cluster(id_naics4_year) r
outreg2 using tableD1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Country fixed efects, No, Year fixed effects, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base) label append

* Table D2
replace staf=staf/10000000
*1
xi: reg staf tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableD2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy) label
*2
xi: reg staf tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor time_delta* i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableD2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy) label append


############### APPENDIX E
* Table E1
### Table A6 -- Instrumenting tariffs
gen cutkor_tfpr=tariff_cut_export_kor*tfpr_base
gen cutkor_coord=tariff_cut_export_kor*coord_dummy
gen cutkor_tfpr_coord=tariff_cut_export_kor*tfpr_base*coord_dummy
gen cutus_tfpr=tariff_cut_export_us*tfpr_base
gen cutus_coord=tariff_cut_export_us*coord_dummy
gen cutus_tfpr_coord=tariff_cut_export_us*tfpr_base*coord_dummy
gen aus=abs(tariff_cut_export- tariff_cut_export_aus)
gen can=abs(tariff_cut_export- tariff_cut_export_can)
gen chn=abs(tariff_cut_export- tariff_cut_export_chn)
gen jpn=abs(tariff_cut_export- tariff_cut_export_jpn)
gen kor=abs(tariff_cut_export- tariff_cut_export_kor)
gen us=abs(tariff_cut_export- tariff_cut_export_us)
egen tariff_iv_synth=rowmin( aus can chn jpn kor us )
egen tariff_iv_synth1=rowmin(can us aus)
egen tariff_iv_synth2=rowmin(jpn kor chn)
gen cut_synth_tfpr=tariff_iv_synth*tfpr_base
gen cut_synth_coord=tariff_iv_synth*coord_dummy
gen cut_synth_tfpr_coord=tariff_iv_synth*tfpr_base*coord_dummy
gen cut_synth1_tfpr=tariff_iv_synth1*tfpr_base
gen cut_synth1_coord=tariff_iv_synth1*coord_dummy
gen cut_synth1_tfpr_coord=tariff_iv_synth1*tfpr_base*coord_dummy
gen cut_synth2_tfpr=tariff_iv_synth2*tfpr_base
gen cut_synth2_coord=tariff_iv_synth2*coord_dummy
gen cut_synth2_tfpr_coord=tariff_iv_synth2*tfpr_base*coord_dummy
*1
xi: ivreg2 ln_revenue tfpr_base tfpr_coord (tariff_cut_export cut_tfpr cut_coord cut_tfpr_coord= tariff_iv_synth cut_synth_tfpr cut_synth_coord cut_synth_tfpr_coord) MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) partial(i.id_naics4 i.id_country_year)
outreg2 using tableE1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export cut_tfpr cut_coord cut_tfpr_coord) label
*2
xi: ivreg2 ln_revenue tfpr_base tfpr_coord (tariff_cut_export cut_tfpr cut_coord cut_tfpr_coord= tariff_iv_synth1 tariff_iv_synth2 cut_synth1_tfpr cut_synth1_coord cut_synth1_tfpr_coord cut_synth2_tfpr cut_synth2_coord cut_synth2_tfpr_coord) MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) partial(i.id_naics4 i.id_country_year)
outreg2 using tableE1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export cut_tfpr cut_coord cut_tfpr_coord) label append

* Table E2 
label variable eprc_v1 "Labor Flexibility"

*1
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1 MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1) label
*2
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1 MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1) label append
*3
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1 MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1) label append
*4
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1 MFN hhi ln_kl numyears numyears2 ln_labor  time_delta* i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1) label append
*5
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1 MFN hhi ln_kl numyears numyears2 ln_labor  time_delta* i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1) label append
*6
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1 MFN hhi ln_kl numyears numyears2 ln_labor  time_delta* i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol c.tariff_cut_export#c.eprc_v1 c.tfpr_base#c.eprc_v1 c.tariff_cut_export#c.tfpr_base#c.eprc_v1) label append

* Table E3
replace smtshare_1993=0 if smtshare_1993==.
label variable smtshare_1993 "Automation"

*1
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord) label
*2
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max MFN hhi ln_kl numyears numyears2 ln_labor c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord) label append
*3
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol MFN hhi ln_kl numyears numyears2 c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord i.id_naics4 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord) label append
*4
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord time_delta* i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord) label append
*5
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max MFN hhi ln_kl numyears numyears2 ln_labor c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord time_delta* i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord) label append
*6
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol MFN hhi ln_kl numyears numyears2 ln_labor c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord time_delta* i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableE3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol c.tfpr_base#c.smtshare_1993 c.coord#c.smtshare_1993 c.smtshare_1993#c.tfpr_base#c.coord) label append

* Table E4
label variable govint "Govt. Intervention"
label variable cfauthority "Authority over Affliates"
label variable ext "Mandatory Extension of Collective Agreements"
label variable sector "Sectoral Organiz."
label variable unauthority "Authority over Local Branches"
label variable ud "Union Density"
label variable cent "Centralization"
label variable nmw "Minimum Wage"

gen cut_govint=tariff_cut_export*govint
gen tfpr_govint=tfpr_base*govint
gen cut_tfpr_govint=tariff_cut_export*tfpr_base*govint
gen cut_cfauthority=tariff_cut_export*cfauthority
gen tfpr_cfauthority=tfpr_base*cfauthority
gen cut_tfpr_cfauthority=tariff_cut_export*tfpr_base*cfauthority
gen cut_ext=tariff_cut_export*ext
gen tfpr_ext=tfpr_base*ext
gen cut_tfpr_ext=tariff_cut_export*tfpr_base*ext
gen cut_sector=tariff_cut_export*sector
gen tfpr_sector=tfpr_base*sector
gen cut_tfpr_sector=tariff_cut_export*tfpr_base*sector
gen cut_unauthority=tariff_cut_export*unauthority
gen tfpr_unauthority=tfpr_base*unauthority
gen cut_tfpr_unauthority=tariff_cut_export*tfpr_base*unauthority
gen cut_ud=tariff_cut_export*ud
gen tfpr_ud=tfpr_base*ud
gen cut_tfpr_ud=tariff_cut_export*tfpr_base*ud
gen cut_cent=tariff_cut_export*cent
gen tfpr_cent=tfpr_base*cent
gen cut_tfpr_cent=tariff_cut_export*tfpr_base*cent
gen cut_nmw=tariff_cut_export*nmw
gen tfpr_nmw=tfpr_base*nmw
gen cut_tfpr_nmw=tariff_cut_export*tfpr_base*nmw
 *1
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_govint tfpr_govint cut_tfpr_govint MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_govint tfpr_govint cut_tfpr_govint) label
*2
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_cfauthority tfpr_cfauthority cut_tfpr_cfauthority MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_cfauthority tfpr_cfauthority cut_tfpr_cfauthority) label append
*3
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_ext tfpr_ext cut_tfpr_ext MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_ext tfpr_ext cut_tfpr_ext) label append
*4
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_sector tfpr_sector cut_tfpr_sector MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_sector tfpr_sector cut_tfpr_sector) label append
*5
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_unauthority tfpr_unauthority cut_tfpr_unauthority MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_unauthority tfpr_unauthority cut_tfpr_unauthority) label append
*6
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_ud tfpr_ud cut_tfpr_ud MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_ud tfpr_ud cut_tfpr_ud) label append
*7
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_cent tfpr_cent cut_tfpr_cent MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_cent tfpr_cent cut_tfpr_cent) label append
*8
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_nmw tfpr_nmw cut_tfpr_nmw MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord cut_nmw tfpr_nmw cut_tfpr_nmw) label append

* Table E5
label variable tariff_cut_import "Tariff Cuts (imports)"
label variable PRFFinal "Tariff Cuts (input)"
label variable cut1_tfpr_coord "Tariff Cuts (imports)*TFPR*CME"
label variable cut1_tfpr "Tariff Cuts (imports)*TFPR"
label variable cut1_coord "Tariff Cuts (imports)*CME"
label variable cut2_tfpr_coord "Tariff Cuts (input)*TFPR*CME"
label variable cut2_tfpr "Tariff Cuts (input)*TFPR"
label variable cut2_coord "Tariff Cuts (input)*CME"

*1
reghdfe ln_revenue tariff_cut_import tfpr_base cut1_tfpr cut1_coord tfpr_coord cut1_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE5.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, CountryYear FE, Yes, Industry FE, Yes, Innovation, Yes, Corruption, No, Electoral system, No, Migration, No, Unemployement, No, Market structure, No, Access to credit, No, All, No) keep(tariff_cut_import tfpr_base cut1_tfpr cut1_coord tfpr_coord cut1_tfpr_coord) label
*2
reghdfe ln_revenue PRFFinal tfpr_base cut2_tfpr cut2_coord tfpr_coord cut2_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableE5.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, CountryYear FE, Yes, Industry FE, Yes, Innovation, Yes, Corruption, No, Electoral system, No, Migration, No, Unemployement, No, Market structure, No, Access to credit, No, All, No) keep(PRFFinal tfpr_base cut2_tfpr cut2_coord tfpr_coord cut2_tfpr_coord) label append

############### APPENDIX F
* Figure F1
*1
xi: reg ln_revenue tariff_cut_export tfpr_base10 c.tariff_cut_export#c.tfpr_base10 c.tariff_cut_export#i.coord_dummy c.tfpr_base10#i.coord_dummy c.tariff_cut_export#c.tfpr_base10#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) r
*outreg2 using tableF1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base10 c.tariff_cut_export#c.tfpr_base10 c.tariff_cut_export#i.coord_dummy c.tfpr_base10#i.coord_dummy c.tariff_cut_export#c.tfpr_base10#i.coord_dummy)
margins, dydx(tariff_cut_export) at(tfpr_base10=(0(1)7)) over(coord_dummy) atmeans level(90) 
marginsplot, addplot((histogram tfpr_base10 if coord_dummy == 0, percent fcolor(none) lcolor(gs1) yaxis(2) yscale(alt  axis(2))) (histogram tfpr_base10 if coord_dummy == 1, percent fcolor(none) lcolor(red) yaxis(2) yscale(alt  axis(2)))) level(90)
graph save Graph "L:\January_2019_Backup\1. Replication\FigureF1.gph", replace
graph save Graph "L:\January_2019_Backup\1. Replication\FigureF1.pdf", replace

* Table F1
xtile tfpr_base2=tfpr_base, nq(2)
tab tfpr_base2
sum tfpr_base if tfpr_base2==1,d
gen x1=`r(p50)'
sum tfpr_base if tfpr_base2==2,d
gen x2=`r(p50)'
gen tfpr_basex1= tfpr_base-x1
gen tfpr_basex2= tfpr_base-x2
quietly tabulate tfpr_base2 , gen(gamma)

*1
xi: reg ln_revenue tariff_cut_export tfpr_basex1 c.tariff_cut_export#c.tfpr_basex1 c.tariff_cut_export#i.coord_dummy c.tfpr_basex1#i.coord_dummy c.tariff_cut_export#c.tfpr_basex1#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year if gamma1, cluster(id_country_year) r
*margins, dydx(tariff_cut_export) at(tfpr_basex1=35.2433) over(coord_dummy) atmeans level(90) 
outreg2 using tableF1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_basex1 c.tariff_cut_export#c.tfpr_basex1 c.tariff_cut_export#i.coord_dummy c.tfpr_basex1#i.coord_dummy c.tariff_cut_export#c.tfpr_basex1#i.coord_dummy) label
*2
xi: reg ln_revenue tariff_cut_export tfpr_basex2 c.tariff_cut_export#c.tfpr_basex2 c.tariff_cut_export#i.coord_dummy c.tfpr_basex2#i.coord_dummy c.tariff_cut_export#c.tfpr_basex2#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year if gamma2, cluster(id_country_year) r
*margins, dydx(tariff_cut_export) at(tfpr_basex2=37.3963) over(coord_dummy) atmeans level(90) 
outreg2 using tableF1.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_basex2 c.tariff_cut_export#c.tfpr_basex2 c.tariff_cut_export#i.coord_dummy c.tfpr_basex2#i.coord_dummy c.tariff_cut_export#c.tfpr_basex2#i.coord_dummy) label append

* Table F2
sample 1
*1
xi: krls ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year 
outreg2 using tableF2.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label

* Table F3
* Re-load the dataset
cd "L:\January_2019_Backup\1. Replication"
use firm_level, clear
* Relabel main variables
label variable ln_revenue "ln(Revenue)"
label variable coord_dummy "CME"
label variable tariff_cut_export "Export Tariff Cuts"
label variable tfpr_base "TFPR"
label variable wage_max "Wage Ceiling"
label variable empl_pol "Subsidies for VT"
label variable cut_tfpr "Exp Tariff Cuts*TFPR"
label variable cut_coord "Exp Tariff Cuts*CME"
label variable tfpr_coord "TFPR*CME"
label variable cut_tfpr_coord "Exp Tariff Cuts*TFPR*CME"
label variable cut_wage "Exp Tariff Cuts*Wage Ceiling"
label variable tfpr_wage "TFPR*Wage Ceiling"
label variable cut_tfpr_wage "Exp Tariff Cuts*TFPR*Wage Ceiling"
label variable cut_empl "Exp Tariff Cuts*SubsidiesVT"
label variable tfpr_empl "TFPR*SubsidiesVT"
label variable  cut_tfpr_empl "Exp Tariff Cuts*TFPR*SubsidiesVT"

*1
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year [pweight=emplw], cluster(id_country_year) r
outreg2 using tableF3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy) label
*2
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year [pweight=emplw], cluster(id_country_year) r
outreg2 using tableF3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max) label append
*3
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year [pweight=emplw], cluster(id_country_year) r
outreg2 using tableF3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol ) label append
*4
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor  time_delta* i.id_naics4 i.id_country_year [pweight=emplw], cluster(id_country_year) r
outreg2 using tableF3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy) label append
*5
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max MFN hhi ln_kl numyears numyears2 ln_labor  time_delta* i.id_naics4 i.id_country_year [pweight=emplw], cluster(id_country_year) r
outreg2 using tableF3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max) label append
*6
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol MFN hhi ln_kl numyears numyears2 ln_labor  time_delta* i.id_naics4 i.id_country_year [pweight=emplw], cluster(id_country_year) r
outreg2 using tableF3.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy c.tariff_cut_export#i.wage_max c.tfpr_base#i.wage_max c.tariff_cut_export#c.tfpr_base#i.wage_max c.tariff_cut_export#i.empl_pol c.tfpr_base#i.empl_pol c.tariff_cut_export#c.tfpr_base#i.empl_pol ) label append

* Table F4
drop id_country
egen id_country=group(iso2c) 

*1
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor if id_country!=8, absorb(id_country_year id_naics4) cluster(id_country_year) 
outreg2 using tableF4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Year fixed effects, Yes, Industry fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label
*2
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor if id_country!=12, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableF4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Year fixed effects, Yes, Industry fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*3
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor if id_country!=15, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableF4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Year fixed effects, Yes, Industry fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*4
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor if id_country!=16, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableF4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Year fixed effects, Yes, Industry fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*5
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor if id_country!=18, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableF4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Year fixed effects, Yes, Industry fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*6
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor if id_country!=20, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableF4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Year fixed effects, Yes, Industry fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*7
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor if id_country!=23, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableF4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Year fixed effects, Yes, Industry fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append
*8
reghdfe ln_revenue tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor if id_country!=18, absorb(id_naics4 id_country_year) cluster(id_country_year) 
outreg2 using tableF4.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Year fixed effects, Yes, Industry fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label append

* Table F5
*1
reghdfe ln_revenue tariff_cut_export cut_tfpr cut_coord tfpr_coord cut_tfpr_coord MFN hhi ln_kl numyears numyears2 ln_labor, absorb(id_naics4 id_firm id_country_year) cluster(id_country_year) 
outreg2 using tableF5.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Firm fixed effects, Yes) keep(tariff_cut_export tfpr_base cut_tfpr cut_coord tfpr_coord cut_tfpr_coord) label

* Table F6
label variable tariff_cut_export_pre "Export Tariff Cuts (pre-2003)"

*1
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy tariff_cut_export_pre c.tariff_cut_export_pre#c.tfpr_base c.tariff_cut_export_pre#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export_pre#c.tfpr_base#i.coord_dummy MFN hhi ln_kl numyears numyears2 ln_labor i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableF6.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, No) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy tariff_cut_export_pre c.tariff_cut_export_pre#c.tfpr_base c.tariff_cut_export_pre#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export_pre#c.tfpr_base#i.coord_dummy) label
*2
xi: reg ln_revenue tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy MFN tariff_cut_export_pre c.tariff_cut_export_pre#c.tfpr_base c.tariff_cut_export_pre#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export_pre#c.tfpr_base#i.coord_dummy hhi ln_kl numyears numyears2 ln_labor  time_delta* i.id_naics4 i.id_country_year, cluster(id_country_year) r
outreg2 using tableF6.xls, bdec(3) tdec(2) addstat(`e(r2_p)') addtext(Controls, Yes, Country-year fixed effects, Yes, Industry fixed effects, Yes, Trends, Yes) keep(tariff_cut_export tfpr_base c.tariff_cut_export#c.tfpr_base c.tariff_cut_export#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export#c.tfpr_base#i.coord_dummy tariff_cut_export_pre c.tariff_cut_export_pre#c.tfpr_base c.tariff_cut_export_pre#i.coord_dummy c.tfpr_base#i.coord_dummy c.tariff_cut_export_pre#c.tfpr_base#i.coord_dummy) label append

log close
